package com.example.liteflow.nd;

import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeComponent;
import com.yomahub.liteflow.slot.Slot;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;

/**
 * 节点组件信息
 *
 * @author chen.an
 * @date 2024-08-14 13:48
 */
@Slf4j
@LiteflowComponent(id = "Node1", name = "节点1")
public class Node1 extends NodeComponent {
    @Override
    public void process() throws Exception {
        Slot slot = this.getSlot();
        //      同等作用
        //        Map<String, String> data = this.getRequestData();
        Map<String, String> data = slot.getRequestData();
        Map<String, String> node = Map.of("Node1", "Node1");
        log.info("Node1节点组件【{}】-Node,获取数据：{},写入参数：{}", Thread.currentThread().threadId(), data, node);
        //传递请求数据
        slot.setRequestData(node);
        //写私有数据
        slot.setPrivateDeliveryData(this.getNodeId(), node);
    }
}
